import Vue from 'vue'
import Router from 'vue-router'

//HelloWorld在components目录下的HelloWorld文件
//@符号指的是src目录

Vue.use(Router)

//这个文件最终导出的内容，就是路由的配置项
export default new Router({
  routes: [
    {
      path: '/',
      //当访问根路径的时候
      name: 'Home',
      component: ()=>import('@/pages/home/Home')
      //根路径所对应的内容是Home这个组件
    },{
      path:'/city',
      name:'City',
      component:()=>import('@/pages/city/City')
    },{
      path:'/detail/:id',
      name:'Detail',
      component:()=>import('@/pages/detail/Detail')
    }
  ],
  scrollBehavior(to,from,savedPosition){
    return {x:0,y:0}
  }
})
